package com.confinderence;

import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TableLayout;

/**
 * A placeholder fragment containing a simple view.
 */
public class ConferencesTableFragment extends Fragment {
	public interface IProvider {
		public void initTable(TableLayout tl);
	}
	public static final String URL = "http://" + Utils.IP + "/ConferenceManager/rest/conferences";
	private TableLayout mTableLayout;
	private IProvider mProvider;
	private Context mContext;

	public ConferencesTableFragment(IProvider provider, Context context) {
		mProvider = provider;
		mContext = context;
		mTableLayout = new TableLayout(context);
	}
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_conference_list, container, false);
		mTableLayout = (TableLayout) rootView.findViewById(R.id.conferencesTable);
		mTableLayout.removeAllViews();
		mProvider.initTable(mTableLayout);
		return rootView;
	}
}